package com.sky.mapper;

import com.sky.dto.OrdersCancelDTO;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.entity.Orders;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface OrdersMapper {
    void insert(Orders orders);

    /**
     * 根据订单号和用户id查询订单
     * @param orderNumber
     * @param userId
     */
    @Select("select * from orders where number = #{orderNumber} and user_id= #{userId}")
    Orders getByNumberAndUserId(String orderNumber, Long userId);

    /**
     * 修改订单信息
     * @param orders
     */
    void update(Orders orders);

    List<Orders> conditionSearch(@Param("dto") OrdersPageQueryDTO dto);

    Orders selectById(@Param("id") Long id);


    void cancel(Orders orders);

    @Select("select * from orders")
    List<Orders> list();

    @Select("select * from orders where id=#{ordersCancelDTO.id}")
    Orders getByid(@Param("ordersCancelDTO") OrdersCancelDTO ordersCancelDTO);
}
